<?php

require_once 'init.php';
require_once 'cf/shop.php';

if (!$user) {
	header('Location: /register');
	exit;
}



$user_id = $user->id();

$view = array();

if($user_id) {

	$view = cf\query2arrays(
			"SELECT cf_orders.id, created, comments, cf_order_states.name AS state, customer_name 
			FROM cf_orders 
			INNER JOIN cf_order_states 
			ON cf_orders.state_id = cf_order_states.id 
			WHERE cf_orders.user_id=$user_id 
			ORDER BY created DESC"

		);
}

$smarty->assign('view', $view);

//var_dump($view); die();

show( 
	'order_history', 
	'Личный кабинет', 
	array(array('name'=>'Личный кабинет'))
);
?>